package com.yxw.live_vod_boot.service.impl;



import lombok.extern.slf4j.Slf4j;
//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.hutool.core.util.ObjectUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yxw.live_vod_boot.entity.LiveShopApplyAddressPunishEntity;
import com.yxw.live_vod_facade.dto.LiveShopApplyAddressPunishQueryDTO;
import com.yxw.live_vod_boot.mapper.LiveShopApplyAddressPunishMapper;
import com.yxw.live_vod_boot.service.ILiveShopApplyAddressPunishService;



/*** 
*@author Jiaxu.Huang
*@date 2024/1/23 16:40:16
*@update 2024/1/23 16:40:16
**/
@Slf4j
@Service
//public class LiveShopApplyAddressPunishServiceImpl  extends ServiceImpl<LiveShopApplyAddressPunishMapper, LiveShopApplyAddressPunishEntity> implements ILiveShopApplyAddressPunishService{
public class LiveShopApplyAddressPunishServiceImpl  implements ILiveShopApplyAddressPunishService{
    @Autowired
    private LiveShopApplyAddressPunishMapper oLiveShopApplyAddressPunishMapper;


    /*** 
    * 自定义查询VIEW
    * @param oLiveShopApplyAddressPunishDTO
    * @return List<LiveShopApplyAddressPunishEntity>
    **/
    @Override
    public List<LiveShopApplyAddressPunishEntity> selectLiveShopApplyAddressPunishList(LiveShopApplyAddressPunishQueryDTO oLiveShopApplyAddressPunishQueryDTO)
    {
        QueryWrapper<LiveShopApplyAddressPunishEntity> oLiveShopApplyAddressPunishQueryWrapper = new QueryWrapper();
        oLiveShopApplyAddressPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oLiveShopApplyAddressPunishQueryDTO.getApplyId()),"apply_id",oLiveShopApplyAddressPunishQueryDTO.getApplyId());
        oLiveShopApplyAddressPunishQueryWrapper.ge(ObjectUtil.isNotEmpty(oLiveShopApplyAddressPunishQueryDTO.getCreateTimeStart()),"create_time",oLiveShopApplyAddressPunishQueryDTO.getCreateTimeStart());
        oLiveShopApplyAddressPunishQueryWrapper.le(ObjectUtil.isNotEmpty(oLiveShopApplyAddressPunishQueryDTO.getCreateTimeEnd()),"create_time",oLiveShopApplyAddressPunishQueryDTO.getCreateTimeEnd());
        oLiveShopApplyAddressPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oLiveShopApplyAddressPunishQueryDTO.getLiveId()),"live_id",oLiveShopApplyAddressPunishQueryDTO.getLiveId());
        oLiveShopApplyAddressPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oLiveShopApplyAddressPunishQueryDTO.getLiveShopId()),"live_shop_id",oLiveShopApplyAddressPunishQueryDTO.getLiveShopId());
        oLiveShopApplyAddressPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oLiveShopApplyAddressPunishQueryDTO.getLiveState()),"live_state",oLiveShopApplyAddressPunishQueryDTO.getLiveState());
        oLiveShopApplyAddressPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oLiveShopApplyAddressPunishQueryDTO.getPunishType()),"punish_type",oLiveShopApplyAddressPunishQueryDTO.getPunishType());
        oLiveShopApplyAddressPunishQueryWrapper.like(ObjectUtil.isNotEmpty(oLiveShopApplyAddressPunishQueryDTO.getMerchantName()),"merchant_name",oLiveShopApplyAddressPunishQueryDTO.getMerchantName());
        oLiveShopApplyAddressPunishQueryWrapper.like(ObjectUtil.isNotEmpty(oLiveShopApplyAddressPunishQueryDTO.getShopName()),"shop_name",oLiveShopApplyAddressPunishQueryDTO.getShopName());
        //List<LiveShopApplyAddressPunishEntity> oListLiveShopApplyAddressPunish = oLiveShopApplyAddressPunishMapper.selectList(oLiveShopApplyAddressPunishQueryWrapper);
        //return Res.ok(oListLiveShopApplyAddressPunish);
        return  oLiveShopApplyAddressPunishMapper.selectList(oLiveShopApplyAddressPunishQueryWrapper);
    }
    /*** 
    * 自定义统计VIEW
    * @param oLiveShopApplyAddressPunishEntity
    * @return Integer
    **/
    @Override
    public Integer selectLiveShopApplyAddressPunishCount(LiveShopApplyAddressPunishQueryDTO oLiveShopApplyAddressPunishQueryDTO)
    {
        QueryWrapper<LiveShopApplyAddressPunishEntity> oLiveShopApplyAddressPunishQueryWrapper = new QueryWrapper();
        oLiveShopApplyAddressPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oLiveShopApplyAddressPunishQueryDTO.getApplyId()),"apply_id",oLiveShopApplyAddressPunishQueryDTO.getApplyId());
        oLiveShopApplyAddressPunishQueryWrapper.ge(ObjectUtil.isNotEmpty(oLiveShopApplyAddressPunishQueryDTO.getCreateTimeStart()),"create_time",oLiveShopApplyAddressPunishQueryDTO.getCreateTimeStart());
        oLiveShopApplyAddressPunishQueryWrapper.le(ObjectUtil.isNotEmpty(oLiveShopApplyAddressPunishQueryDTO.getCreateTimeEnd()),"create_time",oLiveShopApplyAddressPunishQueryDTO.getCreateTimeEnd());
        oLiveShopApplyAddressPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oLiveShopApplyAddressPunishQueryDTO.getLiveId()),"live_id",oLiveShopApplyAddressPunishQueryDTO.getLiveId());
        oLiveShopApplyAddressPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oLiveShopApplyAddressPunishQueryDTO.getLiveShopId()),"live_shop_id",oLiveShopApplyAddressPunishQueryDTO.getLiveShopId());
        oLiveShopApplyAddressPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oLiveShopApplyAddressPunishQueryDTO.getLiveState()),"live_state",oLiveShopApplyAddressPunishQueryDTO.getLiveState());
        oLiveShopApplyAddressPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oLiveShopApplyAddressPunishQueryDTO.getPunishType()),"punish_type",oLiveShopApplyAddressPunishQueryDTO.getPunishType());
        oLiveShopApplyAddressPunishQueryWrapper.like(ObjectUtil.isNotEmpty(oLiveShopApplyAddressPunishQueryDTO.getMerchantName()),"merchant_name",oLiveShopApplyAddressPunishQueryDTO.getMerchantName());
        oLiveShopApplyAddressPunishQueryWrapper.like(ObjectUtil.isNotEmpty(oLiveShopApplyAddressPunishQueryDTO.getShopName()),"shop_name",oLiveShopApplyAddressPunishQueryDTO.getShopName());
        return oLiveShopApplyAddressPunishMapper.selectCount(oLiveShopApplyAddressPunishQueryWrapper);
    }
    /*** 
    * 自定义分页查询VIEW
    * @param currentPage 当前页
    * @param pageSize 分页大小
    * @param oLiveShopApplyAddressPunishEntity
    * @return Page
    **/
    @Override
    public Page selectLiveShopApplyAddressPunishPage(int currentPage,int pageSize,LiveShopApplyAddressPunishQueryDTO oLiveShopApplyAddressPunishQueryDTO)
    {
        if(currentPage <= 1)
        {
            currentPage = 1;
        }
        if(pageSize <= 0)
        {
            pageSize = 10;
        }
        Page<LiveShopApplyAddressPunishEntity> pageParams = new Page<>(currentPage,pageSize);
        QueryWrapper<LiveShopApplyAddressPunishEntity> oLiveShopApplyAddressPunishQueryWrapper = new QueryWrapper();
        oLiveShopApplyAddressPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oLiveShopApplyAddressPunishQueryDTO.getApplyId()),"apply_id",oLiveShopApplyAddressPunishQueryDTO.getApplyId());
        oLiveShopApplyAddressPunishQueryWrapper.ge(ObjectUtil.isNotEmpty(oLiveShopApplyAddressPunishQueryDTO.getCreateTimeStart()),"create_time",oLiveShopApplyAddressPunishQueryDTO.getCreateTimeStart());
        oLiveShopApplyAddressPunishQueryWrapper.le(ObjectUtil.isNotEmpty(oLiveShopApplyAddressPunishQueryDTO.getCreateTimeEnd()),"create_time",oLiveShopApplyAddressPunishQueryDTO.getCreateTimeEnd());
        oLiveShopApplyAddressPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oLiveShopApplyAddressPunishQueryDTO.getLiveId()),"live_id",oLiveShopApplyAddressPunishQueryDTO.getLiveId());
        oLiveShopApplyAddressPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oLiveShopApplyAddressPunishQueryDTO.getLiveShopId()),"live_shop_id",oLiveShopApplyAddressPunishQueryDTO.getLiveShopId());
        oLiveShopApplyAddressPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oLiveShopApplyAddressPunishQueryDTO.getLiveState()),"live_state",oLiveShopApplyAddressPunishQueryDTO.getLiveState());
        oLiveShopApplyAddressPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oLiveShopApplyAddressPunishQueryDTO.getPunishType()),"punish_type",oLiveShopApplyAddressPunishQueryDTO.getPunishType());
        oLiveShopApplyAddressPunishQueryWrapper.like(ObjectUtil.isNotEmpty(oLiveShopApplyAddressPunishQueryDTO.getMerchantName()),"merchant_name",oLiveShopApplyAddressPunishQueryDTO.getMerchantName());
        oLiveShopApplyAddressPunishQueryWrapper.like(ObjectUtil.isNotEmpty(oLiveShopApplyAddressPunishQueryDTO.getShopName()),"shop_name",oLiveShopApplyAddressPunishQueryDTO.getShopName());
        return oLiveShopApplyAddressPunishMapper.selectPage(pageParams, oLiveShopApplyAddressPunishQueryWrapper);
    }
}
    

